-
Notifications
You must be signed in to change notification settings - Fork 162
EVM: Pending transaction handling nonce #2382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
31bbfbe to
ecaa36b
Compare
4a63ad1 to
a65dc7d
Compare
ecaa36b to
434ec95
Compare
Greptile OverviewGreptile SummaryEnhanced Key changes:
The logic correctly handles the case where no pending transactions exist (returns 0, then takes max with committed nonce). However, the approach of using only the maximum pending nonce may not handle nonce gaps optimally - if an address has pending transactions with non-sequential nonces, this could suggest higher nonces than necessary. Confidence Score: 4/5
Important Files Changed
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 file reviewed, 1 comment
| let pending_nonce = if is_pending { | ||
| let pending_txs: Vec<_> = self.pending_transactions.collect_infallible(state); | ||
| pending_txs | ||
| .iter() | ||
| .filter(|pending| pending.transaction.signer == address) | ||
| .map(|pending| pending.transaction.signed_transaction.nonce()) | ||
| .max() | ||
| .map(|nonce| nonce.saturating_add(1)) | ||
| .unwrap_or(0) | ||
| } else { | ||
| 0 | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential edge case with nonce gaps. If pending transactions have non-sequential nonces (e.g., nonces 5 and 10), this returns 11, but nonce 6-9 would still be valid. Standard Ethereum behavior tracks all pending nonces, not just the max.
Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/module-system/module-implementations/sov-evm/src/rpc/handlers.rs
Line: 169:180
Comment:
Potential edge case with nonce gaps. If pending transactions have non-sequential nonces (e.g., nonces 5 and 10), this returns 11, but nonce 6-9 would still be valid. Standard Ethereum behavior tracks all pending nonces, not just the max.
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good point!
Description
Adds a check for higher nonce in
Evm.pending_transactionsCHANGELOG.mdwith a new entry if my PR makes any breaking changes or fixes a bug. If my PR removes a feature or changes its behavior, I provide help for users on how to migrate to the new behavior.Cargo.tomlchanges before opening the PRs. (Are all new dependencies necessary? Is any module dependency leaked into the full-node (hint: it shouldn't)?)Testing
All existing tests are passing
Docs
No updates